//q9.cpp
//This program gets a number and return whether it divides by 11
//
//Binyamin 11 Jan 2018
//===========================================================================

#include<iostream>

using namespace std;

//alternate_sum
//input: a number
//output: the sum of the alternating digits
int alternate_sum(int num)
{
	if(num< 10) return num;
	return num%10 -1 * alternate_sum(num/10);
}
//is_devided
//input: a number
//output: wether the number divides by 11
bool is_devided(int num)
{
	int result = alternate_sum(num);
	if(result == 0) return true;
	if(result < 0) return (-1 * alternate_sum(result)) == 0;
	if(result < 10) return false;
	return alternate_sum(result) == 0;
	
}
//1. prompt the user for a number
//2. capture the number
//3. print whether the number divides by 11
int main()
{
	int num; //user input
	cout << "Please enter a number" << endl;
	cin >> num;
	if(is_devided(num)) cout << "The number is divided by 11" << endl;
	else cout << "The number is not divided by 11" << endl;
	return 0;
}
//output
//Please enter a number
//121
//The number is divided by 11
